//
//  WSJVersionCheck.m
//  WC
//
//  Created by wsj2015 on 16/2/19.
//  Copyright © 2016年 ShanghaiCize Trade And Business Co., Ltd. All rights reserved.
//

#import "WSJVersionCheck.h"
#import "JCAlertView.h"
@implementation WSJVersionCheck


+ (void)getAppNewVersion:(void (^)(NSString *newVersion))successBlock

{
//    [WCNetworkAccessManager sharedMg] POST:<#(NSString *)#> parameters:<#(id)#> success:<#^(id responseObject)success#> failure:<#^(NSString *msg)failure#> netError:<#^(id error)netError#> always:<#^(void)always#>
    
    if (successBlock) {
        successBlock(@"2.0.1");
    }
    
}

+ (void)checkAppVersion{
    
    
    NSString *version =[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
    [self getAppNewVersion:^(NSString *newVersion) {
        if (![version isEqualToString:newVersion]) {
            [JCAlertView showTwoButtonsWithTitle:@"更新提示" Message:@"新版本发布啦!" ButtonType:JCAlertViewButtonTypeCancel ButtonTitle:@"暂不更新" Click:^{
                
            } ButtonType:JCAlertViewButtonTypeDefault ButtonTitle:@"马上去更新" Click:^{
                
                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://itunes.apple.com/cn/app/hu-li-jia360-yi-hu-ban/id1024948697?mt=8"]];
            }];
        }
    }];
    
    

}

@end
